{% extends "base.html" %}
{% load static %}

{% block title %}新增资产 - 学校管理平台{% endblock %}
{% block description %}新增资产借用信息{% endblock %}
{% block keywords %}新增资产, 资产管理, 学校管理系统{% endblock %}

{# 引入资产菜单组件 #}
{% include "components/menu_asset.html" %}

{% block content %}
<div class="layui-container" style="padding: 20px;">
    <div class="layui-card">
        <div class="layui-card-header">
            <i class="layui-icon layui-icon-form"></i> 新增资产
        </div>
        <div class="layui-card-body">
            <form class="layui-form" action="/assets/add/" method="post">
                {% csrf_token %}
                <div class="layui-form-item">
                    <label class="layui-form-label">编号</label>
                    <div class="layui-input-block">
                        <input type="text" name="data_id" required lay-verify="required" placeholder="请输入编号" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">使用人</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" required lay-verify="required" placeholder="请输入使用人" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">手机号</label>
                    <div class="layui-input-block">
                        <input type="text" name="mobile" required lay-verify="phone" placeholder="请输入手机号" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">借用日期</label>
                    <div class="layui-input-block">
                        <input type="text" name="data_time" id="data-time" required lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否归还</label>
                    <div class="layui-input-block">
                        <select name="ret_data" lay-verify="required">
                            <option value="1">已归还</option>
                            <option value="2">未归还</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="save-asset">保存</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<script src="{% static 'js/layui.js' %}"></script>
<script>
layui.use(['jquery', 'layer', 'form', 'laydate'], function () {
    const $ = layui.jquery;
    const layer = layui.layer;
    const form = layui.form;
    const laydate = layui.laydate;

    // 初始化日期选择器
    laydate.render({
        elem: '#data-time',
        format: 'yyyy-MM-dd'
    });

    // 表单提交逻辑可自行添加
});
</script>
{% endblock %}
